{extend name="common/base" /}
{block name="menu"}{/block} {//关掉菜单}
{block name="header"}{/block} {//关掉头部}
{block name="seo"}
<title>{$title}</title>
<meta name="keywords" content="H-ui.admin v3.0,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.0，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
{/block}
{block name="content"}
<article class="cl pd-20">
	<form action="" method="post" class="form form-horizontal" id="form-admin-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>姓名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				{if condition="$info.user eq 'admin'"} <!-- admin用户默认不能修改 -->
				<input type="text" class="input-text " disabled value="{$info.name}" placeholder="" id="adminName" name="name">
				{else /}
					{if condition="$Think.session.user_info.user eq 'admin'"}
					<input type="text" class="input-text " value="{$info.name}" placeholder="" id="adminName" name="name">
					{else /}
					<input type="text" class="input-text " disabled value="{$info.name}" placeholder="" id="adminName" name="name">
					{/if}
				{/if}
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="password" class="input-text" autocomplete="off" value="{$info.password}" placeholder="密码" id="password" name="password">
			</div>
		</div>
		<!--<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>性别：</label>
			<div class="formControls col-xs-8 col-sm-9 skin-minimal">
				<div class="radio-box">
					<input name="sex" type="radio" id="sex-1" checked>
					<label for="sex-1">男</label>
				</div>
				<div class="radio-box">
					<input type="radio" id="sex-2" name="sex">
					<label for="sex-2">女</label>
				</div>
			</div>
		</div>-->
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$info.tel}" placeholder="" id="phone" name="tel">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邮箱：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" placeholder="@" name="email" id="email" value="{$info.email}">
			</div>
		</div>
		{if condition="$Think.session.user_info.name eq 'admin'"}
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">&nbsp;&nbsp;角色：</label>
			<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
				<select class="select" name="role" size="1">
					<option value="1" {if condition="($info.user eq 'admin') AND ($info.role eq '超级管理员')"}selected{/if}>超级管理员</option>
					<option value="0" {if condition="($info.user neq 'admin') AND ($info.role eq '管理员')"}selected{/if}>管理员</option>
				</select>
				</span> </div>
		</div>
		{/if}
		<!--<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">备注：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="" cols="" rows="" class="textarea"  placeholder="说点什么...100个字符以内" dragonfly="true" onKeyUp="textarealength(this,100)"></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
			</div>
		</div>-->
		<input type="hidden" name="id" value="{$info.id}" />
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius disabled" id="submit" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>
{/block}
{block name="js"}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function(){
	$('form').children().change(function(){
		$('#submit').removeClass('disabled');
	});

	$('#submit').on('click',function(event){
		$.ajax({
			type:'post',
			url:'{:url('user/editUser')}',
			data:$('#form-admin-add').serialize(),
			dataTpye:'json',
			success:function(data){
				if(data.status == 1){
					layer.msg('更新成功。', {
						icon: 1,//提示的样式
						time: 1000, //2秒关闭（如果不配置，默认是3秒）//设置后不需要自己写定时关闭了，单位是毫秒
						end:function(){
							window.parent.location.reload(); //刷新父页面
							var index = parent.layer.getFrameIndex(window.name);
							parent.layer.close(index);
						}
					});
				}else{
					layer.msg('更新失败。',{icon:2,time:1500});
				}
			}
		});
	});
});
</script>
{/block}
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
